package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.POJO.HealthProgram;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.service.HealthProgramService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/healthProgram")
public class HealthProgramControllr {

    @Reference
    private HealthProgramService healthProgramService;

    @RequestMapping("/findAllHealthProgramKeywordList")
    public Result findAllHealthProgramKeywordList() {

        try {
            List<HealthProgram> list = healthProgramService.findAllHealthProgramKeywordList();
            return new Result(true, MessageConstant.GET_HEALTH_PROGRAM_SUCCESS, list);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.GET_HEALTH_PROGRAM_FAIL);
        }
    }
}
